#include <math.h>
#include <iostream>
#include <string>
using namespace std;

long long ip2long(string s) {
    string nums[4];
    int cnt = 0;
    int take = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == '.') {
            nums[cnt++] = s.substr(take, i - take);
            take = i + 1;
        }
    }
    nums[cnt++] = s.substr(take, s.length());

    long long ans = stoi(nums[3]) + stoi(nums[2]) * pow(2, 8) +
                    stoi(nums[1]) * pow(2, 16) + stoi(nums[0]) * pow(2, 24);
    return ans;
}

void long2ip(string s) {
    long long num = stoll(s);
    int a0 = num % (long long)pow(2, 8);
    num /= pow(2, 8);
    int a1 = num % (long long)pow(2, 8);
    num /= pow(2, 8);
    int a2 = num % (long long)pow(2, 8);
    num /= pow(2, 8);
    int a3 = num;
    cout << a3 << "." << a2 << "." << a1 << "." << a0 << endl;
}


int main() {
    string s;
    cin >> s;

    long long num = ip2long(s);
    cout << num << endl;
    cin >> s;

    long2ip(s);
    return 0;
}